<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link rel="icon" type="image/x-icon" href="/favicon.ico"/>
    <link rel="stylesheet" href="/assets/theme/Font-Awesome-4.4.0/css/font-awesome.css"/>
    <link rel="stylesheet" href="/assets/plugins/layui2.4.5/css/layui.css"/>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/font-awesome.min.css">
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="/ftl/css/base.css">

    <script src="/assets/jquery/jquery-3.3.1.min.js"></script>
    <script src="/assets/plugins/layui2.4.5/layui.js"></script>
    <script src="/assets/plugins/validation/jquery.form.js"></script>
    <script src="/assets/plugins/validation/jquery.validate.min.js"></script>
    <script src="/assets/plugins/validation/messages_zh.js"></script>
    <script src="/assets/plugins/validation/jquery.validate.supply.js"></script>
    <script src="/assets/jquery/jquery.formFill.js"></script>
    <script src="/assets/plugins/utils/string.js"></script>
    <script src="/assets/plugins/utils/date.js"></script>

    <script src="libs/vue.min.js"></script>
    <script src="js/common.js"></script>

    <style type="text/css">
        .layui-table, .layui-table-view {
            margin-top: 2px !important;
        }
    </style>
    <script>
        /**
         * 在页面中任何嵌套层次的窗口中获取顶层窗口
         * @return 当前页面的顶层窗口对象
         */
        function getTopWinow() {
            var topParent = window;
            while (topParent != topParent.parent) {
                topParent = topParent.parent;
            }
            return topParent;
        }

        var _pageNum = 1;
        var _pageSize = 20;

        var pageResponse = {  //如果无需自定义数据响应名称，可不加该参数
            statusName: 'code', //数据状态的字段名称，默认：code
            statusCode: '10000', //成功的状态码，默认：0
            msgName: 'msg', //状态信息的字段名称，默认：msg
            countName: 'total', //数据总数的字段名称，默认：count
            dataName: 'data' //数据列表的字段名称，默认：data
        };
        var pageRequest = { //如果无需自定义请求参数，可不加该参数
            pageName: 'pageNum', //页码的参数名称，默认：page
            limitName: 'pageSize' //每页数据量的参数名，默认：limit
        };
        var pagenation = { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
            layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'],//自定义分页布局
            first: false, //不显示首页
            last: false,//不显示尾页
            theme: '#1E9FFF',
            limits: [10, 20, 40],
            prev: '上一页',
            next: '下一页'
        };
        /*表单序列化转JSON*/
        $.fn.serializeJson = function () {
            var arr = this.serializeArray();
            var json = {};
            arr.forEach(function (item) {
                var name = item.name;
                var value = item.value;

                if (!json[name]) {
                    json[name] = value;
                } else if ($.isArray(json[name])) {
                    json[name].push(value);
                } else {
                    json[name] = [json[name], value];
                }
            });
            return json;
        };
        /*非表单 容器转 JSon*/
        $.fn.containerJson = function () {
            var inputArr = this.find("input");
            var json = {};
            for (var i = 0; i < inputArr.length; i++) {
                var item = inputArr[i];
                var name = item.name;
                var value = item.value;
                if (!json[name]) {
                    json[name] = value;
                } else if ($.isArray(json[name])) {
                    json[name].push(value);
                } else {
                    json[name] = [json[name], value];
                }
            }
            return json;
        };

        //dateformat
        function dateFormatter(value) {
            if (value) {
                var date = new Date(value);
                var Y = date.getFullYear() + "-";
                var M = check(date.getMonth() + 1) + "-";
                var D = check(date.getDate()) + " ";
                var H = check(date.getHours()) + ":";
                var m = check(date.getMinutes()) + ":";
                var s = check(date.getSeconds());
                return Y + M + D + H + m + s;
            }
        }

        //检查是不是两位数字，不足补全
        function check(str) {
            str = str.toString();
            if (str.length < 2) {
                str = '0' + str;
            }
            return str;
        }

    </script>
</head>
<body>
<div id="rrapp">
    <form class="layui-form layui-form-pane div_search" style="padding-left: 15px;" id="searchForm">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"> 表名 </label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input"
                           type="text">
                </div>
            </div>
            <div class="layui-inline">
                <button id="search" class="layui-btn " data-type="query">
                    <i class="layui-icon">&#xe615;</i>查询
                </button>
                <button id="reset" class="layui-btn layui-btn-warm" data-type="generator">生成代码</button>
            </div>
        </div>
    </form>
    <table id="jqGrid"></table>
</div>
<script src="js/generator.js"></script>
</body>
</html>